import request from '../utils/request'

// 商品相关API接口

export const productApi = {
  // 获取商品列表
  getProductList: (params) => request.get('/product/list', { params }),
  
  // 获取商品详情
  getProductDetail: (id) => request.get(`/product/${id}`),
  
  // 添加商品
  addProduct: (data) => request.post('/product', data),
  
  // 更新商品
  updateProduct: (id, data) => request.put(`/product/${id}`, data),
  
  // 删除商品
  deleteProduct: (id) => request.delete(`/product/${id}`),
  
  // 批量删除商品
  batchDeleteProduct: (ids) => request.post('/product/batch-delete', { ids }),
  
  // 获取商品分类
  getCategoryList: () => request.get('/product/category/list'),
  
  // 获取商品品牌
  getBrandList: () => request.get('/product/brand/list'),
  
  // 商品上下架
  changeProductStatus: (id, status) => request.put(`/product/${id}/status`, { status })
}

export default productApi